home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2004 June
/
PCWorld_2004-06_cd.bin
/
software
/
vyzkuste
/
koolmoves
/
kmsetup.exe
/
{app}
/
Motion Scripts
/
Merging Parts
/
effect2.txt
Wrap
Text File
|
2004-03-21
|
2KB
|
78 lines
// main_init function
main_init = function(mc){
d = deg360 / 360 * effect_angle;
box = function ( mc, tl_x, tl_y, br_x, br_y ){
mc.lineStyle();
mc.beginFill(0);
mc.moveTo (tl_x,tl_y);
mc.lineTo (br_x,tl_y);
mc.lineTo (br_x,br_y);
mc.lineTo (tl_x,br_y);
mc.endFill();
}
}
// main_effect function
main_effect = function(mc,frame){
if (subs_done) end_effect = true;
}
// sub_init function
sub_init = function(mc){
b = mc.getBounds(mc);
p = $padding /2;
m = mc._parent;
for (i=1;i<=4;i++){
mc.duplicateMovieClip("p"+i+"_"+mc._i,mc._i*10+i);
m.createEmptyMovieClip("m"+i+"_"+mc._i,mc._i*10+i+5);
part = m["p"+i+"_"+mc._i];
part._visible = false;
msk = m["m"+i+"_"+mc._i];
part.setMask(msk);
if (out_effect){
part._x = msk._x = mc.__x;
part._y = msk._y = mc.__y;
} else {
part._x = msk._x = mc.__x - Math.cos(deg90 * i - d) * distance;
part._y = msk._y = mc.__y - Math.sin(deg90 * i - d) * distance;
}
}
box (m["m1_"+mc._i],b.xMin+p,b.yMin+p,0,0);
box (m["m2_"+mc._i],0,b.yMin+p,b.xMax-p,0);
box (m["m3_"+mc._i],0,0,b.xMax-p,b.yMax-p);
box (m["m4_"+mc._i],b.xMin+p,0,0,b.yMax-p);
if (!out_effect) mc._alpha = 0;
}
// sub_effect function
sub_effect = function(mc,frame){
perc = frame / lastsubframe;
if (out_effect) {
perc = 1 - perc;
mc._alpha = 0;
}
m = mc._parent;
for (i=1;i<=4;i++){
part = m["p"+i+"_"+mc._i];
msk = m["m"+i+"_"+mc._i];
part._x = msk._x = mc.__x - Math.cos(deg90 * i - d) * distance * (1-perc);
part._y = msk._y = mc.__y - Math.sin(deg90 * i - d) * distance * (1-perc);
if (rotation) part._rotation = msk._rotation = perc * 360;
if (fade) part._alpha = perc * 100;
part._visible = true;
}
if (frame == lastsubframe) {
for (i=1;i<=4;i++){
m["p"+i+"_"+mc._i].removeMovieClip();
m["m"+i+"_"+mc._i].removeMovieClip();
}
if (!out_effect) mc._alpha = 100;
mc.done = true;
}
}